﻿using Sustainalytics.Entities;
using Sustainalytics.ESG.Entities;
using System;
using System.Collections.Generic;

namespace Sustainalytics.ClientDW.Entities
{
    /// <summary>
    /// Company ESG score.
    /// </summary>
    public class EsgCorporateScore
    {
        /// <summary>
        /// Company ID.
        /// </summary>
        public Guid CompanyId { get; set; }

        /// <summary>
        /// Company name.
        /// </summary>
        public string CompanyName { get; set; }

        /// <summary>
        /// Company ESG score.
        /// </summary>
        public double Score { get; set; }
    }

    /// <summary>
    /// Company Environment summary.
    /// </summary>
    public class EsgScoreSummary
    {
        /// <summary>
        /// Company Environment score.
        /// </summary>
        public int Score { get; set; }

        /// <summary>
        /// Company Environment position.
        /// </summary>
        public RPAssessment EsgPosition { get; set; }

        /// <summary>
        /// Company Environment weight
        /// </summary>
        public float? Weight { get; set; }
    }

    /// <summary>
    /// Company overall assessement.
    /// </summary>
    public class EsgOverallAssessment : IEntity, ICompanyRelatedEntity, IHasCompanyId
    {
        /// <summary>
        /// Analyst commentary as input from Analyst Interface.
        /// </summary>
        public string AnalystCommentary { get; set; }

        public Guid Id { get; set; }
        public Guid CompanyId { get; set; }
    }



    /// <summary>
    /// Company ESG overall performance summary.
    /// </summary>
    public class EsgOverallPerformanceSummary : IEntity, ICompanyRelatedEntity, IHasUniverseIds, IHasCompanyId
    {
        /// <summary>
        /// Company ESG overall performance summary.
        /// </summary>
        public EsgScoreSummary Overall { get; set; }

        /// <summary>
        /// Company ESG Environment performance summary.
        /// </summary>
        public EsgScoreSummary Environment { get; set; }

        /// <summary>
        /// Company ESG Social performance summary.
        /// </summary>
        public EsgScoreSummary Social { get; set; }

        /// <summary>
        /// Company ESG Governance performance summary.
        /// </summary>
        public EsgScoreSummary Governance { get; set; }

        /// <summary>
        /// Company ESG percentile performance summary.
        /// </summary>
        public EsgPercentileSummary Percentile { get; set; }

        /// <summary>
        /// Company ESG relative performance summary.
        /// </summary>
        public EsgRelativePositionSummary Relative { get; set; }

        public Guid Id { get; set; }
        public Guid CompanyId { get; set; }        

        public List<int> UniverseIds { get; set; }

        public DateTime? LastUpdate { get; set; }
    }

    /// <summary>
    /// Company ESG percentile summary.
    /// </summary>
    public class EsgPercentileSummary
    {
        /// <summary>
        /// Company percentile rank within the comparative group.
        /// </summary>
        public int Percentile { get; set; }

        /// <summary>
        /// Company overallscore ESG position.
        /// </summary>
        public RPAssessment EsgPosition { get; set; }

        public bool IsInReferenceUniverse { get; set; }
    }

    /// <summary>
    /// Company ESG relative position.
    /// </summary>
    public class EsgRelativePosition : IEntity, ICompanyRelatedEntity, IHasUniverseIds, IHasCompanyId
    {
        /// <summary>
        /// Company ESG relative position summary.
        /// </summary>
        public EsgRelativePositionSummary PositionSummary { get; set; }

        /// <summary>
        /// Market cap. range starting with.
        /// </summary>
        public double MarketCapRangeFrom { get; set; }

        /// <summary>
        /// Market cap. range ending with.
        /// </summary>
        public double MarketCapRangeTo { get; set; }

        /// <summary>
        /// Top ESG score companies.
        /// </summary>
        public EsgCorporateScore[] TopList { get; set; }

        /// <summary>
        /// Company market cap. peers list.
        /// </summary>
        public EsgCorporateScore[] PeersList { get; set; }

        public Guid Id { get; set; }
        public Guid CompanyId { get; set; }

        public List<int> UniverseIds { get; set; }
    }



    /// <summary>
    /// Company ESG relative position.
    /// </summary>
    public class EsgRelativePositionSummary
    {
        /// <summary>
        /// Company rank within the comparative group.
        /// </summary>
        public int ComparativeGroupRank { get; set; }

        /// <summary>
        /// Number of companies within the comparative group.
        /// </summary>
        public int ComparativeGroupSize { get; set; }

        /// <summary>
        /// Company ESG position.
        /// </summary>
        public RPAssessment EsgPosition { get; set; }

        public bool IsInReferenceUniverse { get; set; }
    }
}
